package com.ydl.learning.flink.demo.transformations

import com.ydl.learning.flink.demo.Utils
import org.apache.flink.api.scala._

/**
 * cogroup 先根据where和equalTo分组，之后做关联
 *
 * @author ydl
 * @since 2020/10/13
 */
object CoGroupDemo extends App with Utils {
  val input1 = env.fromElements((1, 2), (1, 5), (2, 3), (3, 4))
  val input2 = env.fromElements((4, 1), (5, 2), (7, 2), (6, 4))
  input1.coGroup(input2).where(0).equalTo(1).collect().foreach(a => {
    a._1.foreach(println)
    println("aaa")
    a._2.foreach(println)
    println("bbb")
    println()
  })
}
